package top.zuli.package03.exam01;

public interface Hero2 {
    public void buyHero();
    public void userHero();

    public static void main(String[] args) {
        Hero2 hero2 = HeroFactory2.getHero("鲁班");
        hero2.buyHero();
        hero2.userHero();
        Hero2 hero21 = HeroFactory2.getHero("亚瑟");
        hero21.buyHero();
        hero21.userHero();

    }
}
class LuBan implements Hero2{

    @Override
    public void buyHero() {
        System.out.println("4999金币可以购买鲁班");
    }

    @Override
    public void userHero() {
        System.out.println("攻速型射手");
    }
}
class YaSe implements Hero2{

    @Override
    public void buyHero() {
        System.out.println("初次登录游戏免费送");
    }

    @Override
    public void userHero() {
        System.out.println("坦克战士");
    }
}
class HeroFactory2{
    public static Hero2 getHero(String name){
        if (name.equals("鲁班")){
            return new LuBan();
        }
        if (name.equals("亚瑟")){
            return new YaSe();
        }
        return null;
    }
}